unit uDMCI;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, ADODB, DBClient;

type
  TDMCI = class(TDataModule)
    dbCentralImpostos: TDatabase;
    NFOperacoes: TQuery;
    NFOperacoesDESCRICAO: TStringField;
    NFOperacoesCFOP: TStringField;
    NFOperacoesTIPONF: TStringField;
    NFOperacoesNFOPER_LIVRE_PEDIDO: TStringField;
    NFOperacoesNFOPER_LIVRE_ESTOQUE: TStringField;
    NFOperacoesID_OPERACAO: TFloatField;
    NFOperacoesNFOPER_ICMS_TIPOTRIB: TFloatField;
    NFOperacoesNFOPER_IPI_TIPOTRIB: TFloatField;
    NFOperacoesNFOPER_PIS_TIPOTRIB: TFloatField;
    NFOperacoesNFOPER_COFINS_TIPOTRIB: TFloatField;
    NFOperacoesNFOPER_ISSQN_TIPOTRIB: TFloatField;
    NFOperacoesNFOPER_ICMS_FIXO_ID: TFloatField;
    NFOperacoesNFOPER_IPI_FIXO_ID: TFloatField;
    NFOperacoesNFOPER_PIS_FIXO_ID: TFloatField;
    NFOperacoesNFOPER_COFINS_FIXO_ID: TFloatField;
    NFOperacoesNFOPER_ISSQN_FIXO_ID: TFloatField;
    NFOperacoesNFOPER_OBS_FISCAL: TBlobField;
    DsNFOperacoes: TDataSource;
    CDSNFOperacoes: TClientDataSet;
    CDSNFOperacoesCFOP: TStringField;
    CDSNFOperacoesTIPONF: TStringField;
    CDSNFOperacoesNFOPER_OBSERV_COTAC: TStringField;
    CDSNFOperacoesNFOPER_OBS_LIVRE: TBlobField;
    CDSNFOperacoesNFOPER_LIVRE_PEDIDO: TStringField;
    CDSNFOperacoesNFOPER_LIVRE_ESTOQUE: TStringField;
    CDSNFOperacoesID_OPERACAO: TFloatField;
    CDSNFOperacoesNFOPER_ICMS_TIPOTRIB: TFloatField;
    CDSNFOperacoesNFOPER_IPI_TIPOTRIB: TFloatField;
    CDSNFOperacoesNFOPER_PIS_TIPOTRIB: TFloatField;
    CDSNFOperacoesNFOPER_COFINS_TIPOTRIB: TFloatField;
    CDSNFOperacoesNFOPER_ISSQN_TIPOTRIB: TFloatField;
    CDSNFOperacoesNFOPER_ICMS_FIXO_ID: TFloatField;
    CDSNFOperacoesNFOPER_IPI_FIXO_ID: TFloatField;
    CDSNFOperacoesNFOPER_PIS_FIXO_ID: TFloatField;
    CDSNFOperacoesNFOPER_COFINS_FIXO_ID: TFloatField;
    CDSNFOperacoesNFOPER_ISSQN_FIXO_ID: TFloatField;
    CDSNFOperacoesIMPOSTO: TStringField;
    CDSNFOperacoesNFOPER_OBS_FISCAL: TBlobField;
    CDSNFOperacoesDESCRICAO: TStringField;
    DSCFOP: TDataSource;
    CDSCFOP: TClientDataSet;
    CDSCFOPDescric: TStringField;
    CDSCFOPCODF_CODIGO: TStringField;
    CDSCFOPNATO_DESCRICAO: TStringField;
    DSCFOP1: TDataSource;
    CDSCFOP1: TClientDataSet;
    Tributacoes: TQuery;
    TributacoesDESCRICAO: TStringField;
    TributacoesBASEDECALCULO: TFloatField;
    TributacoesALIQUOTA: TFloatField;
    TributacoesMENSAGEM: TStringField;
    TributacoesSETORNAIMPRESSORA: TFloatField;
    TributacoesIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesTIPOIMPOSTO: TStringField;
    TributacoesID_CODIGO: TFloatField;
    TributacoesMODBC: TStringField;
    TributacoesDescTributacao: TStringField;
    dsTributacoes: TDataSource;
    CST: TQuery;
    CSTCST: TStringField;
    CSTDESCRICAO: TStringField;
    CSTCodDescr: TStringField;
    dsCST: TDataSource;
    Origem: TQuery;
    OrigemDESCRICAO: TStringField;
    OrigemCODIGO: TFloatField;
    DSOrigem: TDataSource;
    UF: TQuery;
    UFUFSIGLA: TStringField;
    UFUFDESCR: TStringField;
    UFDescriUF: TStringField;
    dsUF: TDataSource;
    CDSCodigoFiscal: TClientDataSet;
    CDSCodigoFiscalcodf_codigo: TStringField;
    CDSCodigoFiscalcodf_tipo: TStringField;
    CodigoFiscal: TQuery;
    DSCodigoFiscal: TDataSource;
    CLFiscalNCM: TQuery;
    CLFiscalNCMMNCM_NF_CLASSFISCAL: TStringField;
    CLFiscalNCMMNCM_CODIGO: TStringField;
    CLFiscalNCMDESCRICAO: TStringField;
    CLFiscalNCMMNCM_DESCRICAO_TIPI: TBlobField;
    CLFiscalNCMMNCM_ID_NCM: TFloatField;
    CLFiscalNCMClassNCM: TStringField;
    dsCLFiscalNCM: TDataSource;
    ConfigsubstTrib: TQuery;
    ConfigsubstTribISUB_UF_SIGLA: TStringField;
    ConfigsubstTribISUB_ID_NCM: TFloatField;
    ConfigsubstTribISUB_ALIQUOTA_INTERNA: TFloatField;
    ConfigsubstTribISUB_MARGEM_IVA: TFloatField;
    ConfigsubstTribISUB_REDUCAO_BCALC: TFloatField;
    ConfigsubstTribISUB_PERCENT_SUBSTIT: TFloatField;
    ConfigsubstTribDescUFST: TStringField;
    CDSSTNCM: TClientDataSet;
    CDSSTNCMISUB_UF_SIGLA: TStringField;
    CDSSTNCMISUB_ID_NCM: TFloatField;
    CDSSTNCMISUB_ALIQUOTA_INTERNA: TFloatField;
    CDSSTNCMISUB_MARGEM_IVA: TFloatField;
    CDSSTNCMISUB_REDUCAO_BCALC: TFloatField;
    CDSSTNCMISUB_PERCENT_SUBSTIT: TFloatField;
    CDSSTNCMDescUF: TStringField;
    CDSSTNCMDescUFST: TStringField;
    CDSSTNCMClassNCM: TStringField;
    CDSSTNCMDescrNCM: TStringField;
    DSSTNCM: TDataSource;
    CDSSTUF: TClientDataSet;
    CDSSTUFISUB_UF_SIGLA: TStringField;
    CDSSTUFISUB_ID_NCM: TFloatField;
    CDSSTUFISUB_ALIQUOTA_INTERNA: TFloatField;
    CDSSTUFISUB_MARGEM_IVA: TFloatField;
    CDSSTUFISUB_REDUCAO_BCALC: TFloatField;
    CDSSTUFISUB_PERCENT_SUBSTIT: TFloatField;
    CDSSTUFDescrNCM: TStringField;
    DSSTUF: TDataSource;
    NCMPORUFPIS: TQuery;
    NCMPORUFPISTIPO_IMPOSTO: TStringField;
    NCMPORUFPISSIGLA_ESTADO: TStringField;
    NCMPORUFPISaliquota: TFloatField;
    NCMPORUFPISBC: TFloatField;
    NCMPORUFPISCFOP: TStringField;
    NCMPORUFPISID_OPERACAO: TFloatField;
    NCMPORUFPISID_TRIBUTACAO: TFloatField;
    NCMPORUFPISClasfiscalNCM: TStringField;
    NCMPORUFPISDescricaoImposto: TStringField;
    DSNCMPORUFPIS: TDataSource;
    CDSNCMPORUFPIS: TClientDataSet;
    CDSNCMPORUFPISTIPO_IMPOSTO: TStringField;
    CDSNCMPORUFPISSIGLA_ESTADO: TStringField;
    CDSNCMPORUFPISaliquota: TFloatField;
    CDSNCMPORUFPISBC: TFloatField;
    CDSNCMPORUFPISCFOP: TStringField;
    CDSNCMPORUFPISID_OPERACAO: TFloatField;
    CDSNCMPORUFPISID_TRIBUTACAO: TFloatField;
    CDSNCMPORUFPISClasfiscalNCM: TStringField;
    CDSNCMPORUFPISDescricaoImposto: TStringField;
    NCMPORUFIPI: TQuery;
    NCMPORUFIPITIPO_IMPOSTO: TStringField;
    NCMPORUFIPISIGLA_ESTADO: TStringField;
    NCMPORUFIPIaliquota: TFloatField;
    NCMPORUFIPIBC: TFloatField;
    NCMPORUFIPICFOP: TStringField;
    NCMPORUFIPIID_OPERACAO: TFloatField;
    NCMPORUFIPIID_TRIBUTACAO: TFloatField;
    NCMPORUFIPIClasfiscalNCM: TStringField;
    NCMPORUFIPIDescricaoImposto: TStringField;
    dsNCMPORUFIPI: TDataSource;
    CDSNCMPORUFIPI: TClientDataSet;
    CDSNCMPORUFIPITIPO_IMPOSTO: TStringField;
    CDSNCMPORUFIPISIGLA_ESTADO: TStringField;
    CDSNCMPORUFIPIaliquota: TFloatField;
    CDSNCMPORUFIPIBC: TFloatField;
    CDSNCMPORUFIPICFOP: TStringField;
    CDSNCMPORUFIPIID_OPERACAO: TFloatField;
    CDSNCMPORUFIPIID_TRIBUTACAO: TFloatField;
    CDSNCMPORUFIPIClasfiscalNCM: TStringField;
    CDSNCMPORUFIPIDescricaoImposto: TStringField;
    NCMPORUF: TQuery;
    dsNCMPORUF: TDataSource;
    CDSNCMPORUF: TClientDataSet;
    Tributacoes1: TQuery;
    Tributacoes1DESCRICAO: TStringField;
    Tributacoes1BASEDECALCULO: TFloatField;
    Tributacoes1ALIQUOTA: TFloatField;
    Tributacoes1MENSAGEM: TStringField;
    Tributacoes1SETORNAIMPRESSORA: TFloatField;
    Tributacoes1IMP_SIT_TRIBUTARIA: TFloatField;
    Tributacoes1TIPOIMPOSTO: TStringField;
    Tributacoes1ID_CODIGO: TFloatField;
    Tributacoes1MODBC: TStringField;
    Tributacoes1DescTributacao: TStringField;
    Tributacoes1Descri: TStringField;
    dsTributacoes1: TDataSource;
    TributacoesIPI: TQuery;
    TributacoesIPIDESCRICAO: TStringField;
    TributacoesIPIBASEDECALCULO: TFloatField;
    TributacoesIPIALIQUOTA: TFloatField;
    TributacoesIPIMENSAGEM: TStringField;
    TributacoesIPISETORNAIMPRESSORA: TFloatField;
    TributacoesIPIIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesIPITIPOIMPOSTO: TStringField;
    TributacoesIPIID_CODIGO: TFloatField;
    TributacoesIPIMODBC: TStringField;
    TributacoesIPIDescTributacao: TStringField;
    TributacoesIPIDescri: TStringField;
    dsTributacoesIPI: TDataSource;
    TributacoesPIS: TQuery;
    TributacoesPISDESCRICAO: TStringField;
    TributacoesPISBASEDECALCULO: TFloatField;
    TributacoesPISALIQUOTA: TFloatField;
    TributacoesPISMENSAGEM: TStringField;
    TributacoesPISSETORNAIMPRESSORA: TFloatField;
    TributacoesPISIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesPISTIPOIMPOSTO: TStringField;
    TributacoesPISID_CODIGO: TFloatField;
    TributacoesPISMODBC: TStringField;
    TributacoesPISDescTributacao: TStringField;
    TributacoesPISDescri: TStringField;
    dsTributacoesPIS: TDataSource;
    TributacoesCOFINS: TQuery;
    TributacoesCOFINSDESCRICAO: TStringField;
    TributacoesCOFINSBASEDECALCULO: TFloatField;
    TributacoesCOFINSALIQUOTA: TFloatField;
    TributacoesCOFINSMENSAGEM: TStringField;
    TributacoesCOFINSSETORNAIMPRESSORA: TFloatField;
    TributacoesCOFINSIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesCOFINSTIPOIMPOSTO: TStringField;
    TributacoesCOFINSID_CODIGO: TFloatField;
    TributacoesCOFINSMODBC: TStringField;
    TributacoesCOFINSDescTributacao: TStringField;
    TributacoesCOFINSDescri: TStringField;
    dsTributacoesCOFINS: TDataSource;
    TributacoesISSQN: TQuery;
    TributacoesISSQNDESCRICAO: TStringField;
    TributacoesISSQNBASEDECALCULO: TFloatField;
    TributacoesISSQNALIQUOTA: TFloatField;
    TributacoesISSQNMENSAGEM: TStringField;
    TributacoesISSQNSETORNAIMPRESSORA: TFloatField;
    TributacoesISSQNIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesISSQNTIPOIMPOSTO: TStringField;
    TributacoesISSQNID_CODIGO: TFloatField;
    TributacoesISSQNMODBC: TStringField;
    TributacoesISSQNDescTributacao: TStringField;
    TributacoesISSQNDescri: TStringField;
    dsTributacoesISSQN: TDataSource;
    DSCODIGOST: TDataSource;
    CODIGOST: TQuery;
    CODIGOSTDESCRICAO: TStringField;
    CODIGOSTCST: TStringField;
    CDSNCMPORUFISSQN: TClientDataSet;
    CDSNCMPORUFISSQNTIPO_IMPOSTO: TStringField;
    CDSNCMPORUFISSQNSIGLA_ESTADO: TStringField;
    CDSNCMPORUFISSQNaliquota: TFloatField;
    CDSNCMPORUFISSQNBC: TFloatField;
    CDSNCMPORUFISSQNCFOP: TStringField;
    CDSNCMPORUFISSQNID_OPERACAO: TFloatField;
    CDSNCMPORUFISSQNID_TRIBUTACAO: TFloatField;
    CDSNCMPORUFISSQNClasfiscalNCM: TStringField;
    CDSNCMPORUFISSQNDescricaoImposto: TStringField;
    DSNCMPORUFISSQN: TDataSource;
    NCMPORUFISSQN: TQuery;
    NCMPORUFISSQNTIPO_IMPOSTO: TStringField;
    NCMPORUFISSQNSIGLA_ESTADO: TStringField;
    NCMPORUFISSQNaliquota: TFloatField;
    NCMPORUFISSQNBC: TFloatField;
    NCMPORUFISSQNCFOP: TStringField;
    NCMPORUFISSQNID_OPERACAO: TFloatField;
    NCMPORUFISSQNID_TRIBUTACAO: TFloatField;
    NCMPORUFISSQNClasfiscalNCM: TStringField;
    NCMPORUFISSQNDescricaoImposto: TStringField;
    CDSNCMPORUFCOFINS: TClientDataSet;
    CDSNCMPORUFCOFINSTIPO_IMPOSTO: TStringField;
    CDSNCMPORUFCOFINSSIGLA_ESTADO: TStringField;
    CDSNCMPORUFCOFINSaliquota: TFloatField;
    CDSNCMPORUFCOFINSBC: TFloatField;
    CDSNCMPORUFCOFINSCFOP: TStringField;
    CDSNCMPORUFCOFINSID_OPERACAO: TFloatField;
    CDSNCMPORUFCOFINSID_TRIBUTACAO: TFloatField;
    CDSNCMPORUFCOFINSClasfiscalNCM: TStringField;
    CDSNCMPORUFCOFINSDescricaoImposto: TStringField;
    DSNCMPORUFCOFINS: TDataSource;
    NCMPORUFCOFINS: TQuery;
    NCMPORUFCOFINSTIPO_IMPOSTO: TStringField;
    NCMPORUFCOFINSSIGLA_ESTADO: TStringField;
    NCMPORUFCOFINSaliquota: TFloatField;
    NCMPORUFCOFINSBC: TFloatField;
    NCMPORUFCOFINSCFOP: TStringField;
    NCMPORUFCOFINSID_OPERACAO: TFloatField;
    NCMPORUFCOFINSID_TRIBUTACAO: TFloatField;
    NCMPORUFCOFINSClasfiscalNCM: TStringField;
    NCMPORUFCOFINSDescricaoImposto: TStringField;
    Query1: TQuery;
    CodigoSTRel: TQuery;
    StringField1: TStringField;
    StringField2: TStringField;
    dsCodigoSTRel: TDataSource;
    CDSCodigoFiscalcodf_descricao: TStringField;
    CodigoFiscalCODF_CODIGO: TStringField;
    CodigoFiscalCODF_TIPO: TStringField;
    CodigoFiscalCODF_CLASSIFICACAO: TStringField;
    Estado: TQuery;
    dsEstado: TDataSource;
    EstadoUFSIGLA: TStringField;
    EstadoUFDESCR: TStringField;
    EstadoDescriUF: TStringField;
    NCMPORUFCOFINSID_NCM: TStringField;
    CDSNCMPORUFCOFINSID_NCM: TStringField;
    NCMPORUFISSQNID_NCM: TStringField;
    CDSNCMPORUFISSQNID_NCM: TStringField;
    NCMPORUFPISID_NCM: TStringField;
    CDSNCMPORUFPISID_NCM: TStringField;
    NCMPORUFIPIID_NCM: TStringField;
    CDSNCMPORUFIPIID_NCM: TStringField;
    NCMPORUFCOFINSCodigoNCM: TFloatField;
    CDSNCMPORUFCOFINSCodigoNCM: TFloatField;
    NCMPORUFISSQNCodigoNCM: TFloatField;
    CDSNCMPORUFISSQNCodigoNCM: TFloatField;
    NCMPORUFPISCodigoNCM: TFloatField;
    CDSNCMPORUFPISCodigoNCM: TFloatField;
    NCMPORUFIPICodigoNCM: TFloatField;
    CDSNCMPORUFIPICodigoNCM: TFloatField;
    TributacoesPDIF: TFloatField;
    TributacoesPCREDICMS: TFloatField;
    CODIGOSTCODIGO: TStringField;
    CODIGOSTSIMPLESNACIONAL: TStringField;
    CDSSTUFSOMASTNF: TStringField;
    CDSSTNCMSOMASTNF: TStringField;
    ConfigsubstTribSOMASTNF: TStringField;
    CodigoFiscalDescr: TStringField;
    CDSCodigoFiscalDescr: TStringField;
    CDSCFOP1CODF_CODIGO: TStringField;
    CDSCFOP1CODF_TIPO: TStringField;
    CDSCFOP1CODF_CLASSIFICACAO: TStringField;
    CDSCFOP1Descr: TStringField;
    CodigoFiscalCODF_DESCRICAO: TMemoField;
    CDSCFOP1CODF_DESCRICAO: TMemoField;
    TributacoesIPINF: TQuery;
    dsTributacoesIPINF: TDataSource;
    TributacoesNF: TQuery;
    dsTributacoesNF: TDataSource;
    TributacoesPISNF: TQuery;
    dsTributacoesPISNF: TDataSource;
    TributacoesCOFINSNF: TQuery;
    dsTributacoesCOFINSNF: TDataSource;
    TributacoesISSQNNF: TQuery;
    dsTributacoesISSQNNF: TDataSource;
    TributacoesNFDESCRICAO: TStringField;
    TributacoesNFBASEDECALCULO: TFloatField;
    TributacoesNFALIQUOTA: TFloatField;
    TributacoesNFMENSAGEM: TStringField;
    TributacoesNFSETORNAIMPRESSORA: TFloatField;
    TributacoesNFIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesNFTIPOIMPOSTO: TStringField;
    TributacoesNFID_CODIGO: TFloatField;
    TributacoesNFMODBC: TStringField;
    TributacoesNFDescTributacao: TStringField;
    TributacoesNFDescri: TStringField;
    TributacoesNFPDIF: TFloatField;
    TributacoesNFPCREDICMS: TFloatField;
    TributacoesIPINFDESCRICAO: TStringField;
    TributacoesIPINFBASEDECALCULO: TFloatField;
    TributacoesIPINFALIQUOTA: TFloatField;
    TributacoesIPINFMENSAGEM: TStringField;
    TributacoesIPINFSETORNAIMPRESSORA: TFloatField;
    TributacoesIPINFIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesIPINFTIPOIMPOSTO: TStringField;
    TributacoesIPINFID_CODIGO: TFloatField;
    TributacoesIPINFMODBC: TStringField;
    TributacoesIPINFDescTributacao: TStringField;
    TributacoesIPINFDescri: TStringField;
    TributacoesPISNFDESCRICAO: TStringField;
    TributacoesPISNFBASEDECALCULO: TFloatField;
    TributacoesPISNFALIQUOTA: TFloatField;
    TributacoesPISNFMENSAGEM: TStringField;
    TributacoesPISNFSETORNAIMPRESSORA: TFloatField;
    TributacoesPISNFIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesPISNFTIPOIMPOSTO: TStringField;
    TributacoesPISNFID_CODIGO: TFloatField;
    TributacoesPISNFMODBC: TStringField;
    TributacoesPISNFDescTributacao: TStringField;
    TributacoesPISNFDescri: TStringField;
    TributacoesCOFINSNFDESCRICAO: TStringField;
    TributacoesCOFINSNFBASEDECALCULO: TFloatField;
    TributacoesCOFINSNFALIQUOTA: TFloatField;
    TributacoesCOFINSNFMENSAGEM: TStringField;
    TributacoesCOFINSNFSETORNAIMPRESSORA: TFloatField;
    TributacoesCOFINSNFIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesCOFINSNFTIPOIMPOSTO: TStringField;
    TributacoesCOFINSNFID_CODIGO: TFloatField;
    TributacoesCOFINSNFMODBC: TStringField;
    TributacoesCOFINSNFDescTributacao: TStringField;
    TributacoesCOFINSNFDescri: TStringField;
    TributacoesISSQNNFDESCRICAO: TStringField;
    TributacoesISSQNNFBASEDECALCULO: TFloatField;
    TributacoesISSQNNFALIQUOTA: TFloatField;
    TributacoesISSQNNFMENSAGEM: TStringField;
    TributacoesISSQNNFSETORNAIMPRESSORA: TFloatField;
    TributacoesISSQNNFIMP_SIT_TRIBUTARIA: TFloatField;
    TributacoesISSQNNFTIPOIMPOSTO: TStringField;
    TributacoesISSQNNFID_CODIGO: TFloatField;
    TributacoesISSQNNFMODBC: TStringField;
    TributacoesISSQNNFDescTributacao: TStringField;
    TributacoesISSQNNFDescri: TStringField;
    CLFiscalNCMCopia: TQuery;
    CLFiscalNCMCopiaMNCM_NF_CLASSFISCAL: TStringField;
    CLFiscalNCMCopiaMNCM_CODIGO: TStringField;
    CLFiscalNCMCopiaDESCRICAO: TStringField;
    CLFiscalNCMCopiaMNCM_DESCRICAO_TIPI: TBlobField;
    CLFiscalNCMCopiaMNCM_ID_NCM: TFloatField;
    CLFiscalNCMCopiaClassNCM: TStringField;
    EstadoCopia: TQuery;
    EstadoCopiaUFSIGLA: TStringField;
    EstadoCopiaUFDESCR: TStringField;
    EstadoCopiaDescriUF: TStringField;
    NCMPORUFCodigoNCM: TFloatField;
    NCMPORUFSIGLA_ESTADO: TStringField;
    NCMPORUFID_TRIBUTACAO: TFloatField;
    NCMPORUFCFOP: TStringField;
    NCMPORUFTIPO_IMPOSTO: TStringField;
    NCMPORUFID_OPERACAO: TFloatField;
    NCMPORUFClasfiscalNCM: TStringField;
    NCMPORUFDescricaoImposto: TStringField;
    NCMPORUFID_NCM: TStringField;
    NCMPORUFPDIF: TFloatField;
    NCMPORUFPCREDICMS: TFloatField;
    NCMPORUFAliquota: TFloatField;
    NCMPORUFBC: TFloatField;
    CDSNCMPORUFSIGLA_ESTADO: TStringField;
    CDSNCMPORUFID_TRIBUTACAO: TFloatField;
    CDSNCMPORUFCFOP: TStringField;
    CDSNCMPORUFTIPO_IMPOSTO: TStringField;
    CDSNCMPORUFID_OPERACAO: TFloatField;
    CDSNCMPORUFClasfiscalNCM: TStringField;
    CDSNCMPORUFDescricaoImposto: TStringField;
    CDSNCMPORUFID_NCM: TStringField;
    CDSNCMPORUFPDIF: TFloatField;
    CDSNCMPORUFPCREDICMS: TFloatField;
    CDSNCMPORUFCodigoNCM: TFloatField;
    CDSNCMPORUFAliquota: TFloatField;
    CDSNCMPORUFBC: TFloatField;
    qryRecuperaEmpresa: TQuery;
    CDSSTUFClassNCM: TStringField;
    ConfigsubstTribClassNCM: TStringField;
    TributacoesALIQUOTA_INTERNA: TFloatField;
    TributacoesIPIALIQUOTA_INTERNA: TFloatField;
    TributacoesPISALIQUOTA_INTERNA: TFloatField;
    TributacoesCOFINSALIQUOTA_INTERNA: TFloatField;
    TributacoesISSQNALIQUOTA_INTERNA: TFloatField;
    TributacoesSOMA_VLRMERCADORIA: TStringField;
    TributacoesSOMA_VLRSEGURO: TStringField;
    TributacoesSOMA_VLRFRETE: TStringField;
    TributacoesSOMA_VLROUTRAS: TStringField;
    TributacoesSOMA_VLRDESCONTO: TStringField;
    TributacoesSOMA_VLRIPI: TStringField;
    TributacoesSOMA_VLRIMPORTACAO: TStringField;
    TributacoesIPIPDIF: TFloatField;
    TributacoesIPIPCREDICMS: TFloatField;
    TributacoesIPISOMA_VLRMERCADORIA: TStringField;
    TributacoesIPISOMA_VLRSEGURO: TStringField;
    TributacoesIPISOMA_VLRFRETE: TStringField;
    TributacoesIPISOMA_VLROUTRAS: TStringField;
    TributacoesIPISOMA_VLRDESCONTO: TStringField;
    TributacoesIPISOMA_VLRIPI: TStringField;
    TributacoesIPISOMA_VLRIMPORTACAO: TStringField;
    TributacoesPISPDIF: TFloatField;
    TributacoesPISPCREDICMS: TFloatField;
    TributacoesPISSOMA_VLRMERCADORIA: TStringField;
    TributacoesPISSOMA_VLRSEGURO: TStringField;
    TributacoesPISSOMA_VLRFRETE: TStringField;
    TributacoesPISSOMA_VLROUTRAS: TStringField;
    TributacoesPISSOMA_VLRDESCONTO: TStringField;
    TributacoesPISSOMA_VLRIPI: TStringField;
    TributacoesPISSOMA_VLRIMPORTACAO: TStringField;
    TributacoesCOFINSPDIF: TFloatField;
    TributacoesCOFINSPCREDICMS: TFloatField;
    TributacoesCOFINSSOMA_VLRMERCADORIA: TStringField;
    TributacoesCOFINSSOMA_VLRSEGURO: TStringField;
    TributacoesCOFINSSOMA_VLRFRETE: TStringField;
    TributacoesCOFINSSOMA_VLROUTRAS: TStringField;
    TributacoesCOFINSSOMA_VLRDESCONTO: TStringField;
    TributacoesCOFINSSOMA_VLRIPI: TStringField;
    TributacoesCOFINSSOMA_VLRIMPORTACAO: TStringField;
    TributacoesISSQNPDIF: TFloatField;
    TributacoesISSQNPCREDICMS: TFloatField;
    TributacoesISSQNSOMA_VLRMERCADORIA: TStringField;
    TributacoesISSQNSOMA_VLRSEGURO: TStringField;
    TributacoesISSQNSOMA_VLRFRETE: TStringField;
    TributacoesISSQNSOMA_VLROUTRAS: TStringField;
    TributacoesISSQNSOMA_VLRDESCONTO: TStringField;
    TributacoesISSQNSOMA_VLRIPI: TStringField;
    TributacoesISSQNSOMA_VLRIMPORTACAO: TStringField;
    TributacoesNFSOMA_VLRMERCADORIA: TStringField;
    TributacoesNFSOMA_VLRSEGURO: TStringField;
    TributacoesNFSOMA_VLRFRETE: TStringField;
    TributacoesNFSOMA_VLROUTRAS: TStringField;
    TributacoesNFSOMA_VLRDESCONTO: TStringField;
    TributacoesNFSOMA_VLRIPI: TStringField;
    TributacoesNFSOMA_VLRIMPORTACAO: TStringField;
    TributacoesNFALIQUOTA_INTERNA: TFloatField;
    TributacoesIPINFPDIF: TFloatField;
    TributacoesIPINFPCREDICMS: TFloatField;
    TributacoesIPINFSOMA_VLRMERCADORIA: TStringField;
    TributacoesIPINFSOMA_VLRSEGURO: TStringField;
    TributacoesIPINFSOMA_VLRFRETE: TStringField;
    TributacoesIPINFSOMA_VLROUTRAS: TStringField;
    TributacoesIPINFSOMA_VLRDESCONTO: TStringField;
    TributacoesIPINFSOMA_VLRIPI: TStringField;
    TributacoesIPINFSOMA_VLRIMPORTACAO: TStringField;
    TributacoesIPINFALIQUOTA_INTERNA: TFloatField;
    TributacoesPISNFPDIF: TFloatField;
    TributacoesPISNFPCREDICMS: TFloatField;
    TributacoesPISNFSOMA_VLRMERCADORIA: TStringField;
    TributacoesPISNFSOMA_VLRSEGURO: TStringField;
    TributacoesPISNFSOMA_VLRFRETE: TStringField;
    TributacoesPISNFSOMA_VLROUTRAS: TStringField;
    TributacoesPISNFSOMA_VLRDESCONTO: TStringField;
    TributacoesPISNFSOMA_VLRIPI: TStringField;
    TributacoesPISNFSOMA_VLRIMPORTACAO: TStringField;
    TributacoesPISNFALIQUOTA_INTERNA: TFloatField;
    TributacoesCOFINSNFPDIF: TFloatField;
    TributacoesCOFINSNFPCREDICMS: TFloatField;
    TributacoesCOFINSNFSOMA_VLRMERCADORIA: TStringField;
    TributacoesCOFINSNFSOMA_VLRSEGURO: TStringField;
    TributacoesCOFINSNFSOMA_VLRFRETE: TStringField;
    TributacoesCOFINSNFSOMA_VLROUTRAS: TStringField;
    TributacoesCOFINSNFSOMA_VLRDESCONTO: TStringField;
    TributacoesCOFINSNFSOMA_VLRIPI: TStringField;
    TributacoesCOFINSNFSOMA_VLRIMPORTACAO: TStringField;
    TributacoesCOFINSNFALIQUOTA_INTERNA: TFloatField;
    TributacoesISSQNNFPDIF: TFloatField;
    TributacoesISSQNNFPCREDICMS: TFloatField;
    TributacoesISSQNNFSOMA_VLRMERCADORIA: TStringField;
    TributacoesISSQNNFSOMA_VLRSEGURO: TStringField;
    TributacoesISSQNNFSOMA_VLRFRETE: TStringField;
    TributacoesISSQNNFSOMA_VLROUTRAS: TStringField;
    TributacoesISSQNNFSOMA_VLRDESCONTO: TStringField;
    TributacoesISSQNNFSOMA_VLRIPI: TStringField;
    TributacoesISSQNNFSOMA_VLRIMPORTACAO: TStringField;
    TributacoesISSQNNFALIQUOTA_INTERNA: TFloatField;
    ConfigsubstTribMODBCST: TStringField;
    CDSSTUFMODBCST: TStringField;
    CDSSTNCMMODBCST: TStringField;
    TributacoesCST: TStringField;
    TributacoesIPICST: TStringField;
    TributacoesPISCST: TStringField;
    TributacoesCOFINSCST: TStringField;
    TributacoesISSQNCST: TStringField;
    TributacoesNFCST: TStringField;
    TributacoesIPINFCST: TStringField;
    TributacoesPISNFCST: TStringField;
    TributacoesCOFINSNFCST: TStringField;
    TributacoesISSQNNFCST: TStringField;
    TributacoesNFCSTTributacao: TStringField;
    CopiaNFOperacao: TQuery;
    CopiaNFOperacaoNCM: TQuery;
    TributacoesIPINFCSTTributacao: TStringField;
    TributacoesPISNFCSTTributacao: TStringField;
    TributacoesCOFINSNFCSTTributacao: TStringField;
    TributacoesISSQNNFCSTTributacao: TStringField;
    CopiaNFOperacaoNCMUF: TQuery;
    CLFiscalNCMMNCM_EXTIPI: TStringField;
    NCMPORUFMNCM_EXTIPI: TStringField;
    CDSNCMPORUFMNCM_EXTIPI: TStringField;
    CDSNCMPORUFIPIMNCM_EXTIPI: TStringField;
    CDSNCMPORUFPISMNCM_EXTIPI: TStringField;
    CDSNCMPORUFCOFINSMNCM_EXTIPI: TStringField;
    CDSNCMPORUFISSQNMNCM_EXTIPI: TStringField;
    NCMPORUFIPIMNCM_EXTIPI: TStringField;
    NCMPORUFPISMNCM_EXTIPI: TStringField;
    NCMPORUFCOFINSMNCM_EXTIPI: TStringField;
    NCMPORUFISSQNMNCM_EXTIPI: TStringField;
    procedure DataModuleCreate(Sender: TObject);
    procedure CDSSTUFCalcFields(DataSet: TDataSet);
    procedure CodigoFiscalCalcFields(DataSet: TDataSet);
    procedure CDSCodigoFiscalCalcFields(DataSet: TDataSet);
    procedure CDSCFOP1CalcFields(DataSet: TDataSet);
    procedure TributacoesNFCalcFields(DataSet: TDataSet);
    procedure TributacoesIPINFCalcFields(DataSet: TDataSet);
    procedure TributacoesPISNFCalcFields(DataSet: TDataSet);
    procedure TributacoesCOFINSNFCalcFields(DataSet: TDataSet);
    procedure TributacoesISSQNNFCalcFields(DataSet: TDataSet);
    procedure CDSNCMPORUFID_NCMGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    procedure CDSNCMPORUFIPIID_NCMGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    procedure CDSNCMPORUFPISID_NCMGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    procedure CDSNCMPORUFCOFINSID_NCMGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    procedure CDSNCMPORUFISSQNID_NCMGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
  private
    procedure Processkey(var Msg: Tmsg; var Handled: Boolean);
    procedure MyShowHint(var HintStr: string; var CanShow: Boolean;
      var HintInfo: THintInfo);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DMCI: TDMCI;

implementation

{$R *.dfm}

procedure TDMCI.CDSCFOP1CalcFields(DataSet: TDataSet);
begin
  CDSCFOP1Descr.AsString := CDSCFOP1CODF_CODIGO.AsString + ' - '+CDSCFOP1codf_descricao.AsString;
end;

procedure TDMCI.CDSCodigoFiscalCalcFields(DataSet: TDataSet);
begin
  CDSCodigoFiscalDescr.AsString := CDSCodigoFiscalCODF_CODIGO.AsString + ' - '+CDSCodigoFiscalCODF_DESCRICAO.AsString;
end;

procedure TDMCI.CDSNCMPORUFCOFINSID_NCMGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  if not CDSNCMPORUFCOFINSMNCM_EXTIPI.IsNull then
    text := CDSNCMPORUFCOFINSID_NCM.AsString + '  EX: ' + CDSNCMPORUFCOFINSMNCM_EXTIPI.AsString
  else
    text := CDSNCMPORUFCOFINSID_NCM.AsString;
end;

procedure TDMCI.CDSNCMPORUFID_NCMGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  if not CDSNCMPORUFMNCM_EXTIPI.IsNull then
    text := CDSNCMPORUFID_NCM.AsString + '  EX: ' + CDSNCMPORUFMNCM_EXTIPI.AsString
  else
    text := CDSNCMPORUFID_NCM.AsString;
end;

procedure TDMCI.CDSNCMPORUFIPIID_NCMGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  if not CDSNCMPORUFIPIMNCM_EXTIPI.IsNull then
    text := CDSNCMPORUFIPIID_NCM.AsString + '  EX: ' + CDSNCMPORUFIPIMNCM_EXTIPI.AsString
  else
    text := CDSNCMPORUFIPIID_NCM.AsString;
end;

procedure TDMCI.CDSNCMPORUFISSQNID_NCMGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  if not CDSNCMPORUFISSQNMNCM_EXTIPI.IsNull then
    text := CDSNCMPORUFISSQNID_NCM.AsString + '  EX: ' + CDSNCMPORUFISSQNMNCM_EXTIPI.AsString
  else
    text := CDSNCMPORUFISSQNID_NCM.AsString;
end;

procedure TDMCI.CDSNCMPORUFPISID_NCMGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  if not CDSNCMPORUFPISMNCM_EXTIPI.IsNull then
    text := CDSNCMPORUFPISID_NCM.AsString + '  EX: ' + CDSNCMPORUFPISMNCM_EXTIPI.AsString
  else
    text := CDSNCMPORUFPISID_NCM.AsString;
end;

procedure TDMCI.CDSSTUFCalcFields(DataSet: TDataSet);
begin
  //CDSSTUFClassNCM.AsString := CDSSTUFISUB_ID_NCM.AsString + ' - '+ CDSSTUFDescrNCM.AsString;
end;

procedure TDMCI.CodigoFiscalCalcFields(DataSet: TDataSet);
begin
  CodigoFiscalDescr.AsString := CodigoFiscalCODF_CODIGO.AsString + ' - '+CodigoFiscalCODF_DESCRICAO.AsString;
end;

procedure TDMCI.DataModuleCreate(Sender: TObject);
var
  list_params: TStrings;
begin

  if not Session.IsAlias('Industrial') then begin
    list_params := TStringList.Create;
    list_params.Add('SERVER NAME=acesso_industrial');
    list_params.Add('USER NAME=user_industrial');
    Session.AddAlias('Industrial', 'ORACLE', list_params);
    list_params.free;
    Session.SaveConfigFile;
  end;
  if not Session.IsAlias('Industrial1') then begin
    list_params := TStringList.Create;
    list_params.Add('SERVER NAME=acesso_industrial');
    list_params.Add('USER NAME=user_industrial1');
    Session.AddAlias('Industrial1', 'ORACLE', list_params);
    list_params.free;
    Session.SaveConfigFile;
  end;

  Application.OnMessage := ProcessKey;
  Application.OnShowHint := MyShowHint;
  try
    dbCentralImpostos.AliasName    := 'Industrial';
    dbCentralImpostos.DatabaseName := 'Industrial';
    dbCentralImpostos.Connected    := true;
  except
    dbCentralImpostos.AliasName    := 'Industrial1';
    dbCentralImpostos.DatabaseName := 'Industrial1';
    dbCentralImpostos.Connected    := true;
  end;

end;

procedure TDMCI.Processkey(var Msg: Tmsg; var Handled: Boolean);
begin
  if Msg.message = WM_KEYDOWN then begin
    if Msg.wParam = VK_RETURN then begin
      Msg.wParam := VK_CLEAR;
      Keybd_event(VK_TAB, 0, 0, 0);
    end;
  end;
end;

procedure TDMCI.TributacoesCOFINSNFCalcFields(DataSet: TDataSet);
begin
  TributacoesCOFINSNFCSTTributacao.AsString := TributacoesCOFINSNFCST.AsString+'-'+TributacoesCOFINSNFDESCRICAO.AsString;
end;

procedure TDMCI.TributacoesIPINFCalcFields(DataSet: TDataSet);
begin
  TributacoesIPINFCSTTributacao.AsString := TributacoesIPINFCST.AsString+'-'+TributacoesIPINFDESCRICAO.AsString;
end;

procedure TDMCI.TributacoesISSQNNFCalcFields(DataSet: TDataSet);
begin
  TributacoesISSQNNFCSTTributacao.AsString := TributacoesISSQNNFCST.AsString+'-'+TributacoesISSQNNFDESCRICAO.AsString;
end;

procedure TDMCI.TributacoesNFCalcFields(DataSet: TDataSet);
begin
  TributacoesNFCSTTributacao.AsString := TributacoesNFCST.AsString+'-'+TributacoesNFDESCRICAO.AsString;
end;

procedure TDMCI.TributacoesPISNFCalcFields(DataSet: TDataSet);
begin
  TributacoesPISNFCSTTributacao.AsString := TributacoesPISNFCST.AsString+'-'+TributacoesPISNFDESCRICAO.AsString;
end;

procedure TDMCI.MyShowHint(var HintStr: string; var CanShow: Boolean;
  var HintInfo: THintInfo);
var
  i: integer;
begin
  for i := 0 to Application.ComponentCount - 1 do
    if Application.Components[i] is THintWindow then
      with THintWindow(Application.Components[i]).Canvas do begin
        Font.Name := 'Courier New';
        Font.Size := 08;
        Font.Style := [];
        HintInfo.HintColor := clInfoBk;
      end;
end;

end.
